<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>任务提醒 - 析码无界</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
        }
        .navbar {
            border-radius: 0;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border: none;
        }
        .navbar-brand {
            color: white !important;
            font-weight: bold;
        }
        .navbar-nav > li > a {
            color: rgba(255,255,255,0.9) !important;
        }
        .navbar-nav > li > a:hover {
            color: white !important;
            background-color: rgba(255,255,255,0.1) !important;
        }
        .panel {
            border: none;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            border-radius: 8px;
        }
        .panel-heading {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 8px 8px 0 0;
        }
        .btn-primary {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border: none;
        }
        .badge {
            padding: 5px 10px;
            font-size: 12px;
        }
        .badge-warning {
            background-color: #f0ad4e;
        }
        .badge-success {
            background-color: #5cb85c;
        }
        .assignment-card {
            margin-bottom: 15px;
            padding: 15px;
            border-left: 4px solid #667eea;
            background: white;
            border-radius: 4px;
        }
        .assignment-card:hover {
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        .avatar-container {
            display: inline-block;
            margin-right: 10px;
            vertical-align: middle;
        }
        .student-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.8);
            object-fit: cover;
            cursor: pointer;
            transition: transform 0.2s;
        }
        .student-avatar:hover {
            transform: scale(1.1);
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="/student" style="display: flex; align-items: center;">
                    <div class="avatar-container">
                        <img th:src="${session.student?.avatar != null and !session.student.avatar.isEmpty() ? '/' + session.student.avatar : ''}" 
                             class="student-avatar"
                             th:onclick="'location.href=\'' + @{/student/settings} + '\''"
                             onerror="if(this.src.indexOf('data:image') === -1) { this.onerror=null; this.src=''; }"
                             alt="头像">
                    </div>
                    <span><i class="fa fa-graduation-cap"></i> 析码无界 - 学生管理平台</span>
                </a>
            </div>
            <ul class="nav navbar-nav">
                <li class="active"><a th:href="@{/student/assignment/list}"><i class="fa fa-bell"></i> 任务提醒</a></li>
                <li><a th:href="@{/student/courses}"><i class="fa fa-book"></i> 我的课程</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="/"><i class="fa fa-sign-out"></i> 退出登录</a></li>
            </ul>
        </div>
    </nav>

    <div class="container" style="margin-top: 20px;">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-bell"></i> 任务提醒</h3>
            </div>
            <div class="panel-body">
                <div th:if="${error}" class="alert alert-danger" th:text="${error}"></div>
                <div th:if="${message}" class="alert alert-success" th:text="${message}"></div>
                
                <div th:if="${#lists.isEmpty(assignments)}" class="alert alert-info">
                    <i class="fa fa-info-circle"></i> 目前没有作业任务
                </div>
                
                <div th:each="assignment : ${assignments}" class="assignment-card">
                    <div class="row">
                        <div class="col-md-8">
                            <h4>
                                <i class="fa fa-file-text"></i> 
                                <span th:text="${assignment?.title} ?: '无标题'"></span>
                                <span th:if="${assignment?.status == 'submitted'}" class="badge badge-success">已提交</span>
                                <span th:if="${assignment?.status != 'submitted'}" class="badge badge-warning">未提交</span>
                            </h4>
                            <div style="margin-top: 5px; margin-bottom: 10px;">
                                <span th:if="${assignment?.subject != null and !assignment.subject.isEmpty()}" 
                                      style="display: inline-block; padding: 3px 8px; background-color: #667eea; color: white; border-radius: 3px; font-size: 12px; margin-right: 10px;">
                                    <i class="fa fa-book"></i> <span th:text="${assignment.subject}"></span>
                                </span>
                                <span th:if="${assignment?.className != null and !assignment.className.isEmpty()}" 
                                      style="color: #666; font-size: 12px;">
                                    <i class="fa fa-users"></i> <span th:text="${assignment.className}"></span>
                                </span>
                            </div>
                            <p style="color: #666; margin-top: 10px;" th:text="${assignment?.content} ?: '无内容描述'"></p>
                            <div style="margin-top: 10px; font-size: 12px; color: #999;">
                                <span><i class="fa fa-calendar"></i> 发布时间：<span th:text="${assignment?.publishTime != null ? #dates.format(assignment.publishTime, 'yyyy-MM-dd HH:mm') : '-'}"></span></span>
                                <span style="margin-left: 20px;"><i class="fa fa-clock-o"></i> 截止时间：<span th:text="${assignment?.deadline != null ? #dates.format(assignment.deadline, 'yyyy-MM-dd HH:mm') : '-'}"></span></span>
                            </div>
                        </div>
                        <div class="col-md-4 text-right">
                            <a th:href="@{/student/assignment/detail(assignmentId=${assignment?.id})}" 
                               class="btn btn-primary">
                                <i class="fa fa-eye"></i> 查看详情
                            </a>
                        </div>
                    </div>
                </div>
                
                <div style="margin-top: 20px;">
                    <a th:href="@{/student}" class="btn btn-default">
                        <i class="fa fa-arrow-left"></i> 返回主页
                    </a>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

